package cn.yan.luowowo.controller;


import cn.yan.luowowo.domain.Region;
import cn.yan.luowowo.service.DestinationService;
import cn.yan.luowowo.service.RegionService;
import cn.yan.luowowo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("destinations")
public class DstinationsController {

    @Autowired
    private RegionService regionService;
    @Autowired
    private DestinationService destinationService;

    @GetMapping("hotRegion")
    public Object hotRegion(){

         return JsonResult.success(regionService.queryHotRegion());
    }


    //查询区域下得目的地
    @GetMapping("search")
    public Object search(String regionId){
        return JsonResult.success(destinationService.queryByReginIdForApi(regionId));
    }


}
